package HotelSystem;

import java.util.Scanner;

public class Test {
    public static void main(String[] args) {
        Hotel hotel = new Hotel();
        while (true) {
            System.out.println("欢迎使用酒店管理系统，请认真阅读以下使用说明:");
            System.out.println("请输入对应的功能编号：[1]查看房间列表;[2]订房;[3]退房;[4]退出系统");
            Scanner scanner = new Scanner(System.in);
            System.out.print("请输入编号:");
            int i = scanner.nextInt();
            if (i == 1) {
                hotel.show();
                System.out.println("已加载所有酒店的房间信息。");
            } else if (i == 2) {
                System.out.println("请输入您想入住的房间号:");
                int rid = scanner.nextInt();
                if (rid >= 1001 && rid <= 1005 || rid >= 2001 && rid <= 2005 || rid >= 3001 && rid <= 3005 || rid >= 4001 && rid <= 4005 || rid >= 5001 && rid <= 5005) {
                    hotel.in(rid);
                } else {
                    System.out.println("请输入正确的房间号");
                }
            } else if (i == 3) {
                System.out.println("请输入您想退订的房间号:");
                int rid = scanner.nextInt();
                if (rid >= 1001 && rid <= 1005 || rid >= 2001 && rid <= 2005 || rid >= 3001 && rid <= 3005 || rid >= 4001 && rid <= 4005 || rid >= 5001 && rid <= 5005) {
                    hotel.out(rid);
                }
            } else if (i == 4) {
                hotel.exit();
                scanner.close();
                return;
            } else {
                System.out.println("请根据使用说明输入正确的1~4的编号进行操作。");
            }
        }
    }
}